<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>投诉</title>
    <meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1, minimum-scale=1">
</head>
<style>
    body{
        margin:0;
        padding:0;
    }
    .cont{
        background: #fff;
        margin-top: 10px;
        /*	background: url(image/p_bg.png);
            background-size: 100%;*/

    }
    .list{
        /*display: flex;*/
        padding-top: 5px;
        justify-content: space-between;
        /*border-bottom: 1px solid #ccc;*/
        /*padding:10px;*/
        width: 90%;
        margin:0 auto;
        color:#666;

    }
    .list input{
        width: 97%;
        height: 30px;
        margin-top: 10px;
        border:1px solid #ccc;
        border-radius: 5px;
        padding:0px 5px;
    }
    .list textarea{
        width:97%;
        margin-top:10px;
        border:1px solid #ccc;
        border-radius: 5px;
        padding:5px;
    }
    .btnk{
        position: fixed;
        bottom: 10px;
        padding:20px;
        box-sizing: border-box;
        width: 100%
    }
    .btnk .btn{
        width:100%;
        height: 40px;
        line-height: 40px;
        background: blue;
        color:#fff;
        text-align: center;
        border-radius: 5px;
    }
</style>
<body>
<div class="cont">
    <div class="list">
        <div class="list_tit">电话:</div>
        <div><input type="text" id="phone" placeholder="请输入"></div>
    </div>
    <div class="list">
        <div class="list_tit">车牌号:</div>
        <div><input type="text" id="car_num" placeholder="请输入"></div>
    </div>
    <div class="list">

        <div class="list_tit">备注:</div>
        <div> <textarea name="" id="beizhu"  cols="30" rows="10"></textarea> </div>
    </div>
    <div class="btnk">
        <div class="btn">提交</div>
    </div>

</div>
</body>
<script src="/assets/libs/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="/assets/js/layui/layui.js"></script>
<script>
    layui.use('layer', function(){
        var layer = layui.layer;

        $(".btn").click(function(){

            var phone=$("#phone").val()
            var car_num=$("#car_num").val()
            var beizhu=$("#beizhu").val()
            if(phone==''){
                layer.alert("请输入电话")
                return false;
            }
            if(car_num==''){
                layer.alert("请输入车牌号")
                return false;
            }
            if(beizhu==''){
                layer.alert("请填写投诉内容")
                return false;
            }
            $.ajax({
                url: "/index/complaint/save",
                dataType: 'JSON',
                data: {
                    phone: phone,
                    car_num:car_num,
                    beizhu:beizhu
                },
                type:"post",
                success: function(result){
                    if(result.code == 1){
                        layer.alert(result.msg, {icon:1}); // 显示2秒后自动关闭
                    }else{
                        layer.alert(result.msg, {icon:2}); // 显示2秒后自动关闭
                    }
                }
            });
        })
    });

</script>
</html>